using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Scatter : Gun
{
    public override void Fire()
    {
        base.Fire();

        float arc = 30;
        float n = 7;
        for (int i = 0; i < n; i++)
        {
            float a = i * (arc / (n - 1)) - 0.5f * arc;
            float random = Random.Range(-5f, 5f);
            float r = (GameMgr.Get<IPlayerManager>().Player.Towards + 90 + random + a) * Mathf.PI / 180;
            float x = Mathf.Cos(r);
            float y = Mathf.Sin(r);

            GameMgr.Get<IBulletManager>().InstantiateBullets("ShotgunBullet", transform.position,
                Vector2.zero, new Vector2(x, y), 1, damage, 0, new List<BulletMotion> { new Straight(0, 0.5f, 30, 0, 30) });
        }

    }
}
